export function getInsertSql(tabName: string, colNames: Array<string>, colValue: Array<string>): string {
    let insql = "INSERT INTO " + tabName + " (";
    let vs = "";

    for (let i = 0; i < colNames.length; ++i) {
        if (i > 0) {
            insql = insql + " , ";
            vs = vs + ",";
        }

        insql = insql + colNames[i];
        vs = vs + `'${colValue[i]}'`;
    }

    insql = insql + ") values(";
    insql = insql + vs;
    insql = insql + ")";
    return insql;
}

export function getUpdateSql(tabName: string, colNames: Array<string>, colValue: Array<string>,
    whereKey: Array<string>, whereValue: Array<string>): string {
    let updStr: string = "UPDATE " + tabName + " SET ";
    for (let i = 0; i < colNames.length; i++) {
        if (i > 0)
            updStr += ",";
        updStr += (colNames[i] + "='" + colValue[i]) + "'";
    }

    let whereStr = "";
    if (whereKey) {
        whereStr = " where ";
        for (let i = 0; i < whereKey.length; i++) {
            if (i > 0) {
                whereStr += " and ";
            }
            whereStr += `${whereKey[i]}='${whereValue[i]}'`;
        }
    }
    return updStr + whereStr;
}